<h1><code ng:non-bindable="">angular.toJson</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve
    this doc</a>

    <h2 id="Description">Description</h2>

    <div class="description">
        <div class="angular-tojson-page"><p>Serializes input into a JSON-formatted string. Properties with leading $
            characters will be
            stripped since angular uses this notation internally.</p></div>
    </div>
    <h2 id="Usage">Usage</h2>

    <div class="usage">
        <pre class="prettyprint linenums">angular.toJson(obj[, pretty]);</pre>
        <h3 id="Parameters">Parameters</h3>
        <ul class="parameters">
            <li><code ng:non-bindable="">obj – {Object|Array|Date|string|number} – </code>

                <div class="angular-tojson-page"><p>Input to be serialized into JSON.</p></div>
            </li>
            <li><code ng:non-bindable="">pretty<i>(optional)</i> – {boolean=} – </code>

                <div class="angular-tojson-page"><p>If set to true, the JSON output will contain newlines and
                    whitespace.</p></div>
            </li>
        </ul>
        <h3 id="Returns">Returns</h3>

        <div class="returns"><code ng:non-bindable="">{string|undefined}</code>
            –
            <div class="angular-tojson-page"><p>Jsonified string representing <code>obj</code>.</p></div>
        </div>
    </div>
</div>
